package com.ruoyi.ftrl.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ftrl.domain.HeatStation;
import com.ruoyi.ftrl.mapper.HeatStationMapper;
import com.ruoyi.ftrl.service.IHeatStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 换热站信息Service业务层处理
 * 
 * @author dihang
 * @date 2024-07-08
 */
@Service
public class HeatStationServiceImpl implements IHeatStationService 
{
    @Autowired
    private HeatStationMapper heatStationMapper;

    /**
     * 查询换热站信息
     * 
     * @param id 换热站信息主键
     * @return 换热站信息
     */
    @Override
    public HeatStation selectHeatStationById(Long id)
    {
        return heatStationMapper.selectHeatStationById(id);
    }

    /**
     * 查询换热站信息列表
     * 
     * @param heatStation 换热站信息
     * @return 换热站信息
     */
    @Override
    public List<HeatStation> selectHeatStationList(HeatStation heatStation)
    {
        return heatStationMapper.selectHeatStationList(heatStation);
    }

    /**
     * 新增换热站信息
     * 
     * @param heatStation 换热站信息
     * @return 结果
     */
    @Override
    public int insertHeatStation(HeatStation heatStation)
    {
        heatStation.setCreateTime(DateUtils.getNowDate());
        heatStation.setCreateBy(SecurityUtils.getUsername());
        return heatStationMapper.insertHeatStation(heatStation);
    }

    /**
     * 修改换热站信息
     * 
     * @param heatStation 换热站信息
     * @return 结果
     */
    @Override
    public int updateHeatStation(HeatStation heatStation)
    {
        heatStation.setUpdateTime(DateUtils.getNowDate());
        heatStation.setUpdateBy(SecurityUtils.getUsername());
        return heatStationMapper.updateHeatStation(heatStation);
    }

    /**
     * 批量删除换热站信息
     * 
     * @param ids 需要删除的换热站信息主键
     * @return 结果
     */
    @Override
    public int deleteHeatStationByIds(Long[] ids)
    {
        return heatStationMapper.deleteHeatStationByIds(ids);
    }

    /**
     * 删除换热站信息信息
     * 
     * @param id 换热站信息主键
     * @return 结果
     */
    @Override
    public int deleteHeatStationById(Long id)
    {
        return heatStationMapper.deleteHeatStationById(id);
    }

    /**
     * 根据片区id查询子级热力站
     */
    @Override
    public List<HeatStation> selectHeatStationLists(Long id) {
        return heatStationMapper.selectHeatStationLists(id);
    }
}
